﻿using ClockInLearning.Db;
using ClockInLearning.Dto;
using ClockInLearning.Impl;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ClockInLearning.Controllers
{
    [ApiController]
    [Route("userRelation")]
    [ServiceFilter(typeof(ApiFilter))]
    public class UserRelationController : Controller
    {
        private readonly UserRelationApplication _application;

        public UserRelationController(AppDbContext context)
        {
            _application = new UserRelationApplication(context);
        }

        [HttpPost("addSupervisor")]
        public async Task<ServiceResult> AddSupervisor(UserRelationInputDto dto)
        {
            return await _application.AddSupervisor(dto);
        }

        [HttpPost("update")]
        public async Task<ServiceResult> Update(UserRelationInputDto dto)
        {
            return await _application.Update(dto);
        }

        [HttpPost("getSupervisedList")]
        public async Task<ServiceResult<List<UserRelationOutputDto>>> GetSupervisedList()
        {
            return await _application.GetSupervisedList();
        }

        [HttpPost("getSupervisorList")]
        public async Task<ServiceResult<List<UserRelationOutputDto>>> GetSupervisorList()
        {
            return await _application.GetSupervisorList();
        }
    }
}
